/*
 * @Author: jiu yin
 * @Date: 2023-04-27 15:06:16
 * @LastEditTime: 2023-04-27 17:09:41
 * @LastEditors: jiu yin zhen jing
 * @FilePath: \admin-react\src\router\utlis\lazy.tsx
 * jiu
 */
import React, { Suspense } from "react";

/**
 * @description 路由懒加载
 * @param {Element} Comp 需要访问的组件
 * @returns element
 */
const lazyLoad = (Comp: React.LazyExoticComponent<any>): React.ReactNode => {
	return (
		<Suspense
			fallback={<Loading />}>
			<Comp />
		</Suspense>
	);
};

function Loading() {
	return <h2>Loading...</h2>;
}
export default lazyLoad;
